import Vue from 'vue'
import Router from 'vue-router'

const home = r => require.ensure([], () => r(require('../pages/home.vue')), 'group-main')
const dynamic = r => require.ensure([], () => r(require('../pages/dynamic.vue')), 'group-main')
const like = r => require.ensure([], () => r(require('../pages/like.vue')), 'group-main')
const my = r => require.ensure([], () => r(require('../pages/my.vue')), 'group-main')
const group = r => require.ensure([], () => r(require('../pages/group.vue')), 'group')
const detail = r => require.ensure([], () => r(require('../pages/detail.vue')), 'group')
const setting = r => require.ensure([], () => r(require('../manage/setting.vue')), 'group-manage')
const authority = r => require.ensure([], () => r(require('../manage/authority.vue')), 'group-manage')
const member = r => require.ensure([], () => r(require('../manage/member.vue')), 'group-manage')
const create = r => require.ensure([], () => r(require('../manage/create.vue')), 'group-manage')
const invite = r => require.ensure([], () => r(require('../manage/invite.vue')), 'group-manage')

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: home
    }, {
      path: '/dynamic/:type',
      name: 'dynamic',
      component: dynamic
    }, {
      path: '/like',
      name: 'like',
      component: like
    }, {
      path: '/my',
      name: 'my',
      component: my
    }, {
      path: '/group',
      name: 'group',
      component: group
    }, {
      path: '/detail',
      name: 'detail',
      component: detail
    },
    {
      //群组设置
      path: '/setting',
      name: 'setting',
      component: setting
    },
    {
      //群组权限设置
      path: '/setting/authority',
      name: 'authority',
      component: authority
    },
    {
      //成员管理
      path: '/setting/member',
      name: 'member',
      component: member
    },
    {
      //嘉宾邀请
      path: '/setting/invite',
      name: 'invite',
      component: invite
    },
    {
      //创建组群
      path: '/create',
      name: 'create',
      component: create
    }
  ]
})
